package com.socialuni.common.user.sdk.repository;


import com.socialuni.common.user.model.DO.CommonUserAccountDO;
import org.springframework.data.jpa.repository.JpaRepository;

public interface CommonUserAccountRepository extends JpaRepository<CommonUserAccountDO, Integer> {

    //查询账号是否注册过，某一渠道
    CommonUserAccountDO findByProviderAndUnionId(String provider, String unionId);
    CommonUserAccountDO findByProviderAndAppOpenId(String provider, String appOpenId);
    CommonUserAccountDO findByProviderAndMpOpenId(String provider, String mpOpenId);

    //根据渠道和用户id查询用户账户信息
    CommonUserAccountDO findByProviderAndUserId(String provider, Integer userId);


    CommonUserAccountDO findByUserId(Integer userId);


//    @CachePut(cacheNames = RedisKeysConst.userById, key = "#account.userId")
//    UserAccountDO save(AccountDO account);

 /*   Optional<AccountDO> findFirstOneByQqMpOpenIdOrderByIdAsc(String qqMpOpenId);
    Optional<AccountDO> findFirstOneByWxMpOpenIdOrderByIdAsc(String wxMpOpenId);

    Optional<AccountDO> findFirstOneByQqUnionIdOrderByIdAsc(String unionId);

    Optional<AccountDO> findFirstOneByWxUnionIdOrderByIdAsc(String unionId);

    Optional<AccountDO> findOneByUserId(Integer userId);
*/
}

